home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / NGL2.0.1J(ppc).sit / NGL2.0.1J(ppc) / Sprite Sample / Sprite_Sample2(PPC).c < prev    next >
C/C++ Source or Header  |  1996-09-17  |  4KB  |  92 lines

  1. /*============================================================
  2.  
  3.                     N_Sprite サンプルプログラム
  4.                     
  5. ============================================================*/
  6.  
  7. #include        "N_Library.h"
  8.  
  9. short        Data_Rsrc = 0;
  10. long            counter = 0;
  11.  
  12. void main(void)
  13. {
  14.     WindowPtr    window;
  15.     short        x,y;
  16.     long            ww;
  17.     short        now_win = 0;
  18.  
  19.     ToolboxInit();
  20.     ColorCheck();
  21.     window = GetNewWindow (129,nil,(WindowPtr)-1L );
  22.     ShowWindow(window);
  23.     SetWTitle(window,"¥pWindow1");
  24.     N_Window_Set_Multi(1,window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),320,240);
  25.     window = GetNewWindow (129,nil,(WindowPtr)-1L );
  26.     MoveWindow(window,-(window->portBits.bounds.left)+50,-(window->portBits.bounds.top)+50,false);
  27.     SetWTitle(window,"¥pWindow2");
  28.     ShowWindow(window);
  29.     N_Window_Set_Multi(2,window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),320,240);
  30.     window = GetNewWindow (129,nil,(WindowPtr)-1L );
  31.     MoveWindow(window,-(window->portBits.bounds.left)+100,-(window->portBits.bounds.top)+100,false);
  32.     SetWTitle(window,"¥pWindow3");
  33.     ShowWindow(window);
  34.     N_Window_Set_Multi(0,window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),320,240);
  35.     Open_Resource_File(128,1,&Data_Rsrc);
  36.     N_Pict_Draw(133,0,0,(GrafPtr)Main_Window,false);
  37.  
  38.     N_Current_Window_Set(0);
  39.     N_Pict_Draw(133,0,0,(GrafPtr)Main_Window,true);
  40.     N_Current_Window_Set(1);
  41.     N_Pict_Draw(133,0,0,(GrafPtr)Main_Window,true);
  42.     N_Current_Window_Set(2);
  43.     N_Pict_Draw(133,0,0,(GrafPtr)Main_Window,true);
  44.     N_Sprite_Set(129,0,128,128,0,1,1,0);                                            //スプライト登録 (0-3)
  45.     N_Sprite_Set(130,1,128,128,0,1,1,0);
  46.     N_Sprite_Set(131,2,32,32,0,1,1,0);
  47.     N_Sprite_Set(132,3,32,32,0,1,1,0);
  48.     Close_Resource_File(&Data_Rsrc);
  49.  
  50.     HideCursor();
  51.     Delay(60,&ww);
  52.     do
  53.     {
  54.     N_Current_Window_Set(now_win);
  55.     x = (GetRandom(0,380) -60);
  56.     y = (GetRandom(0,300) -60);
  57.  
  58.     if (counter>=0 && counter<500*2)            N_Sp_Put_Win(0x00000000,x,y);                //SP0 ノーマル・上書き
  59.     if (counter>=500*2 && counter<1000*2    )    N_Sp_Put_Win(0x00010000,x,y);                //SP0 水平反転・上書き
  60.     if (counter>=1000*2 && counter<1500*2)    N_Sp_Put_Win(0x00020000,x,y);                //SP0 垂直反転・上書き
  61.     if (counter>=1500*2 && counter<2000*2)    N_Sp_Put_Win(0x00030000,x,y);                //SP0 水平・垂直反転・上書き
  62.  
  63.     if (counter>=2000*2 && counter<6000*2)    N_Sp_Put_Win(0x00000002,x,y);                //SP2 ノーマル・上書き
  64.     if (counter>=6000*2 && counter<10000*2)    N_Sp_Put_Win(0x00010002,x,y);                //SP2 水平反転・上書き
  65.     if (counter>=10000*2 && counter<14000*2)    N_Sp_Put_Win(0x00020002,x,y);                //SP2 垂直反転・上書き
  66.     if (counter>=14000*2 && counter<18000*2)    N_Sp_Put_Win(0x00030002,x,y);                //SP2 水平・垂直反転・上書き
  67.  
  68.     if (counter>=18000*2 && counter<18500*2)    N_Sp_Put_Win(0x80000001,x,y);                //SP1 ノーマル・重ね書き
  69.     if (counter>=18500*2 && counter<19000*2)    N_Sp_Put_Win(0x80010001,x,y);                //SP1 水平反転・重ね書き
  70.     if (counter>=19000*2 && counter<19500*2)    N_Sp_Put_Win(0x80020001,x,y);                //SP1 垂直反転・重ね書き
  71.     if (counter>=19500*2 && counter<20000*2)    N_Sp_Put_Win(0x80030001,x,y);                //SP1 水平・垂直反転・重ね書き
  72.  
  73.     if (counter>=20000*2 && counter<24000*2)    N_Sp_Put_Win(0x80000003,x,y);                //SP3 ノーマル・重ね書き
  74.     if (counter>=24000*2 && counter<28000*2)    N_Sp_Put_Win(0x80010003,x,y);                //SP3 水平反転・重ね書き
  75.     if (counter>=28000*2 && counter<32000*2)    N_Sp_Put_Win(0x80020003,x,y);                //SP3 垂直反転・重ね書き
  76.     if (counter>=32000*2 && counter<36000*2)    N_Sp_Put_Win(0x80030003,x,y);                //SP3 水平・垂直反転・重ね書き
  77.  
  78.     if (counter>=72000) counter = 0;
  79.     counter+=2;
  80.  
  81.     now_win++;
  82.     if (now_win == 3) now_win = 0;
  83.     }
  84.     while (!Button());
  85.     ShowCursor();
  86.     ColorRevert();
  87. }
  88.  
  89.  
  90.     
  91.  
  92.